package com.chen.springsecurity.controller;

import com.chen.springsecurity.domain.ResponseResult;
import com.chen.springsecurity.domain.User;
import com.chen.springsecurity.service.LoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Y·C
 * @version 1.0.0
 * @ClassName LoginController.java
 * @Description TODO
 * @createTime 2023年08月28日 16:38:00
 */
@RestController
public class LoginController {

    @Autowired
    private LoginService loginService;

    @PostMapping("/user/login")
    public ResponseResult login(@RequestBody User user){

        //登录
       return loginService.login(user);
    }


    @PostMapping("/user/logout")
    public ResponseResult logout(){
        //退出登录
        return loginService.logout();
    }


}
